home *** CD-ROM | disk | FTP | other *** search
- unit DDUtils;
-
- interface
-
- uses Windows, Classes, SysUtils, DirectX, ComObj;
-
- type
-
- EDDError = Exception;
- ED3DRMError = Exception;
-
- procedure DDCheck(Result: HResult);
- procedure D3DRMCheck(Result: HResult);
-
- implementation
-
- procedure D3DRMError(ErrorCode: HResult);
- var
- ErrMsg: String;
- begin
- case ErrorCode of
- D3DRMERR_BADALLOC: ErrMsg := 'Out of memory.';
- D3DRMERR_BADDEVICE: ErrMsg := 'Device is not compatible with renderer.';
- D3DRMERR_BADFILE: ErrMsg := 'Data file is corrupt.';
- D3DRMERR_BADMAJORVERSION: ErrMsg := 'Bad DLL major version.';
- D3DRMERR_BADMINORVERSION: ErrMsg := 'Bad DLL minor version.';
- D3DRMERR_BADOBJECT: ErrMsg := 'Object expected in argument.';
- D3DRMERR_BADTYPE: ErrMsg := 'Bad argument type passed.';
- D3DRMERR_BADVALUE: ErrMsg := 'Bad argument value passed.';
- D3DRMERR_FACEUSED: ErrMsg := 'Face already used in a mesh.';
- D3DRMERR_FILENOTFOUND: ErrMsg := 'File cannot be opened.';
- D3DRMERR_NOTDONEYET: ErrMsg := 'Unimplemented.';
- D3DRMERR_NOTFOUND: ErrMsg := 'Object not found in specified place.';
- D3DRMERR_UNABLETOEXECUTE: ErrMsg := 'Unable to carry out procedure.';
- end;
- ErrMsg := 'DirectDraw 3D Retained Mode error: ' + ErrMsg;
- raise ED3DRMError.Create(ErrMsg);
- end;
-
- procedure D3DRMCheck(Result: HResult);
- begin
- if Result <> D3DRM_OK then D3DRMError(Result);
- end;
-
- procedure DDError(ErrorCode: HResult);
- begin
- raise EDDError.Create('DirectDraw error');
- end;
-
- procedure DDCheck(Result: HResult);
- begin
- if Result <> DD_OK then DDError(Result);
- end;
-
- end.
-